/**
 * 
 */
package org.myontology.controller.impl;


import org.myontology.controller.AbstractAction;
import org.myontology.controller.Action;
import org.myontology.controller.AttributeHolder;

/**
 *  @author <a href="michael.hackl@sti2.at">Michael Hackl</a>
 * Project: Myontology - www.myontology.org
 * STI
 */
public class SequenceContainer extends AbstractAction {

	private Action[] actions;
	
	public SequenceContainer(Action...actions ) {
		this.actions = actions;
	}
	
	/* (non-Javadoc)
	 * @see org.myontology.controller.Action#execute(org.myontology.controller.AttributeHolder)
	 */
	public void execute(AttributeHolder attributes) throws Exception {
		for (int i=0;i<actions.length;i++) {
			actions[i].execute(attributes);
		}
	}

	@Override
	public Action cloneMe() {
		Action[] newActions = new Action[actions.length];
		for (int i=0; i<newActions.length;i++) {
			newActions[i]=actions[i].cloneMe();
		}
		return new SequenceContainer(newActions);
	}
	
}
